const App = require('../app/controllers/app')

module.exports = function (router, upload) {
  router.post('/deleteGroup', App.deleteGroup)
  router.get('/getGroup', App.getGroup)
  router.post('/groups', App.addGroup)
  router.get('/getsprints', App.getSprints)
  router.post('/sprints', App.addSprint)
  router.post('/updatesprint', App.modifySprint)
  // router.post('/api/reset', App.needSignIn, App.reset)
  // router.post('/api/info/check', App.needSignIn, App.getUserInfo)
  // router.post('/api/info/modify', App.needSignIn, App.modifyInfo)

  router.post('/api/upload', upload.single('image'), async (ctx, next) => {
    // const { originalname, path, mimetype, filename } = ctx.req.file
    ctx.body = {
      code: 1,
      data: {
        imageUrl: ctx.req.file.path.replace('public', '')
      }
    }
  })
  router.post('/api/image/shop', upload.single('image'), async (ctx, next) => {
    // const { originalname, path, mimetype, filename } = ctx.req.file
    ctx.body = {
      code: 1,
      data: {
        imageUrl: ctx.req.file.path.replace('public', '')
      }
    }
  })
}
